#include <stdio.h>
int main(void)
{
    char c;
    int count_1 = 0;
    int count_2 = 0;

    while ((c = getchar()) != '#')
    {
        if (c == '.')
        {
            putchar('!');
            count_1++;
        }
        else if (c == '!')
        {
            putchar('!');
            putchar('!');
            count_2++;
        }
        else
            putchar(c);
    }
    printf("%d replacement(s) of . with !\n", count_1);
    printf("%d replacement(s) of ! with !\n", count_2);

    return 0;
}